/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bitly;

import BitlyAlgo.Shortener;
import Generador.Generador;
import java.net.MalformedURLException;

/**
 *
 * @author Demon
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws MalformedURLException {
        // TODO code application logic here

        // Generador g = new Generador();
        //g.setURL("http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener");
        //g.setPath();
        //g.setMD5();
        menu();


    }

    public static void menu() {
        int next = 1;
        do {
            System.out.println("A continuacion escribe la url que deseas acortar:");
            try {
                java.io.BufferedReader stdin = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
                String url = stdin.readLine().trim();
                Generador g = new Generador();
                g.mainWorker(url);
               

                System.out.println("¿Desea acortar otra url? 1(si), 0(no)");

                //Finaliza operacion con url
                next = Integer.parseInt(stdin.readLine());

            } catch (java.io.IOException e) {
                System.out.println("Error al convertir la url");
            }
        } while (next == 1);

        System.exit(1);
    }

    public static void worker(String url) {
    }
}
